<%-- 
    Document   : viewdeatilcomment
    Created on : Jul 20, 2011, 9:58:52 PM
    Author     : Hai
--%>




<%@page import="server.entity.Comment"%>
<%@page import="server.process.ProcessBeanLocal"%>
<%@page import="java.text.SimpleDateFormat"%>
<%@page import="java.text.DateFormat"%>
<%@page import="javax.naming.InitialContext"%>
<%@page import="javax.naming.Context"%>
<jsp:include page="adminheader.jsp"></jsp:include>
            <div id="main">
                <div id="adminManager">
                   <jsp:include page="lefmenu.jsp"></jsp:include>
                </div>
                <div id="contentAdmin">
                    <fieldset>
                        <legend>View Deatil Comment</legend>
                      
                            <h4>

                                <table border="1">
                                    <thead>
                                        <tr>
                                            
                                            <th>CommentDate</th>
                                            <th>Email</th>
                                            <th>Username</th>
                                            <th>CommentContent</th>
                                            <th>PhotoID</th>
                                            <th>Approved</th>
                                        </tr>
                                    </thead>
                                    <tbody>

                                        <%  Context ctx=new InitialContext();
                                            DateFormat date=new SimpleDateFormat("MM/dd/yyyy");
                                          int name=Integer.parseInt(request.getParameter("name"));
                                            Object obj=ctx.lookup("ProcessLocalJNDI");
                                            ProcessBeanLocal lova=(ProcessBeanLocal)obj;
                                           Comment[] resulr= lova.SearchLikeComment(name);
                                           System.out.println(name);
                                           for(int i=0;i<resulr.length;i++){

                                           boolean isprsd=resulr[i].getApproved();




                                        %>
                                        <tr>
                                    <form action="commentuser" method="post">
                                            
                                            <td><%=date.format(resulr[i].getCommentDate())%></td>
                                            <td><%=resulr[i].getEmail()%></td>
                                            <td><%=resulr[i].getRegisteredUser().getUsername().toString()%></td>
                                            <td><%=resulr[i].getCommentContent()%></td>
                                            <td><%=resulr[i].getPhoto().getPhotoID().toString()%></td>
                                            <td><input type="checkbox" checked="checked" value="ON"<%if(isprsd){%><%}%></td>
                                            <td><input type="hidden" name="txthidecoomet" value="<%=resulr[i].getCommentID()%>" /></td>
                                            <td><input type="submit" value="Delete" name="action" /></td>
                                    </form >
                                        </tr>

                                        <% }
                                        %>
                                    </tbody>
                                </table>



                            </h4>
                      
                    </fieldset>
                </div>
            </div>
            <div id="footer">

            </div>
        </div>
    </body>
</html>
